%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/connections/pagination-before-last-pagination-only.variables"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 12, 13, 27, 28, 14, 17, 18<br />2: PgSelect[11], PgSelect[20]<br />3: Connection[15], PgSelectRows[22]<br />ᐳ: 21, 23, 24"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 15, 24<br /><br />ROOT Connectionᐸ11ᐳ[15]"):::bucket
    end
    Bucket0 --> Bucket1

    %% plan dependencies
    PgSelect11[["PgSelect[11∈0] ➊<br />ᐸmessages+1ᐳ<br />More deps:<br />- Constantᐸ3ᐳ[28]"]]:::plan
    Object14{{"Object[14∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Lambda17{{"Lambda[17∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'INHERIT' ]ᐳ[27]"}}:::plan
    Lambda18{{"Lambda[18∈0] ➊<br />ᐸparseCursorᐳ"}}:::plan
    Object14 & Lambda17 & Lambda18 --> PgSelect11
    PgSelect20[["PgSelect[20∈0] ➊<br />ᐸmessages(aggregate)ᐳ<br />More deps:<br />- Constantᐸ3ᐳ[28]"]]:::plan
    Object14 & Lambda17 & Lambda18 --> PgSelect20
    Connection15[["Connection[15∈0] ➊<br />ᐸ11ᐳ<br />More deps:<br />- Constantᐸ3ᐳ[28]"]]:::plan
    PgSelect11 & Lambda18 --> Connection15
    Access12{{"Access[12∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access13{{"Access[13∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access12 & Access13 --> Object14
    Access9{{"Access[9∈0] ➊<br />ᐸ0.valueᐳ"}}:::plan
    __Value0["__Value[0∈0] ➊<br />ᐸvariableValuesᐳ"]:::plan
    __Value0 --> Access9
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access12
    __Value2 --> Access13
    Access9 --> Lambda18
    First21{{"First[21∈0] ➊"}}:::plan
    PgSelectRows22[["PgSelectRows[22∈0] ➊"]]:::plan
    PgSelectRows22 --> First21
    PgSelect20 --> PgSelectRows22
    PgSelectSingle23{{"PgSelectSingle[23∈0] ➊<br />ᐸmessagesᐳ"}}:::plan
    First21 --> PgSelectSingle23
    PageInfo19{{"PageInfo[19∈1] ➊"}}:::plan
    Connection15 --> PageInfo19
    Access25{{"Access[25∈1] ➊<br />ᐸ15.hasNextPageᐳ"}}:::plan
    PageInfo19 o--o Access25
    Access26{{"Access[26∈1] ➊<br />ᐸ15.hasPreviousPageᐳ"}}:::plan
    Access25 o--o Access26

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value0,__Value2,Access9,PgSelect11,Access12,Access13,Object14,Connection15,Lambda17,Lambda18,PgSelect20,First21,PgSelectRows22,PgSelectSingle23 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PageInfo19,Access25,Access26 bucket1

